package com.neuedu.Servlet;

import javax.servlet.*;
import javax.servlet.annotation.*;
import java.io.IOException;
import javax.servlet.GenericServlet;

@WebServlet(name = "GenericServlet", value = "/GenericServlet")
public class GenericServletDemo extends GenericServlet {
    //      可以直接重写父类，满足当前子类的要求
    @Override
    public void init() throws ServletException {
        System.out.println("GenericServletDemo  被创建了....");
    }

    @Override
    public void service(ServletRequest servletRequest, ServletResponse servletResponse) throws ServletException, IOException {
        super.getServletConfig();//调用父类的配置对象---->父类：servlet
        servletResponse.getWriter().write("我的世界");
        servletResponse.getWriter().write("GenericServletDemo extends GenericServlet");
    }
//
    @Override
    public void destroy() {
        System.out.println("GenericServletDemo  被销毁了....");
    }

}
